﻿using Xacml.Core;
using System.Xml;

namespace Xacml.Core.Context
{
  public class SubjectElementReadWrite : TargetItemBase
  {
    private string _subjectCategory;

    public virtual string SubjectCategory
    {
      get
      {
        return this._subjectCategory;
      }
      set
      {
        this._subjectCategory = value;
      }
    }

    public SubjectElementReadWrite(string subjectCategory, AttributeCollectionReadWrite attributes, XacmlVersion schemaVersion)
      : base(attributes, schemaVersion)
    {
      this._subjectCategory = subjectCategory;
    }

    public SubjectElementReadWrite(XmlReader reader, XacmlVersion schemaVersion)
      : base(reader, "Subject", schemaVersion)
    {
    }

    protected override void AttributeFound(string namespaceName, string attributeName, string attributeValue)
    {
      if (!(attributeName == "SubjectCategory"))
        return;
      this._subjectCategory = attributeValue;
    }

    protected override void NodeFound(XmlReader reader)
    {
    }
  }
}
